package com.yxq.mdt.app.modules.socialcontact.model;

import com.yxq.mdt.app.base.ibase.IBaseModel;
import com.yxq.mdt.app.modules.personal.bean.MainPersonalStateBean;
import com.yxq.mdt.app.modules.publish.ui.bean.PublishListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.AddCommentBean;
import com.yxq.mdt.app.modules.socialcontact.bean.AttentionManAndDynamicBean;
import com.yxq.mdt.app.modules.socialcontact.bean.BrowseListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.ByPageListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.CircleTopicListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.CommunityCentreBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GiftResultBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GivePresentBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GroupDetailBean;
import com.yxq.mdt.app.modules.socialcontact.bean.GroupTopicListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.HomeTopicListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.MainSocialCircleBean;
import com.yxq.mdt.app.modules.socialcontact.bean.MainSocialContactRecommendBean;
import com.yxq.mdt.app.modules.socialcontact.bean.MainSocialHeadBean;
import com.yxq.mdt.app.modules.socialcontact.bean.MainSocialTopBean;
import com.yxq.mdt.app.modules.socialcontact.bean.NearManAndDynamicTopicBean;
import com.yxq.mdt.app.modules.socialcontact.bean.PerfectBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SelectNearbyListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialAllListMember;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialContactAllTopicsBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialPersonalHomepageBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialPersonalMyHomepageBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialStateGiveListLikeBean;
import com.yxq.mdt.app.modules.socialcontact.bean.SubscribersListBean;
import com.yxq.mdt.app.modules.socialcontact.bean.VideoTopicBean;
import com.yxq.mdt.app.net.ApiModel;
import com.yxq.mdt.app.net.BaseObserver;
import com.yxq.mdt.app.net.RetrofitFactory;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;

public class MainSocialContactModel implements IBaseModel {
    @Override
    public void onDestroy() {

    }

    //获取推荐联系人
    public void getMaybeInterest(int pageSize, int pageNum, int hasMobile, int professionId, ApiModel.CommonCallback<MainSocialTopBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getMaybeInterest(pageSize, pageNum, hasMobile, professionId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainSocialTopBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainSocialTopBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //社区顶部关注
    public static void setInterestRelation(String toUserId, int enabled, int type, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).setInterestRelation(toUserId, enabled, type).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<String>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(String baseEntity) throws Exception {
                callback.onSuccess(baseEntity);

            }

        });
    }

    //推荐圈子
    public void getRecommendGroup(String pageNum, String pageSize, ApiModel.CommonCallback<MainSocialCircleBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getRecommendGroup(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainSocialCircleBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainSocialCircleBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //我的圈子
    public void getMyGroupList(int pageNum, int pageSize, ApiModel.CommonCallback<MainSocialCircleBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getMyGroupList(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainSocialCircleBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainSocialCircleBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //全部话题
    public void getContactAllTopicsList(ApiModel.CommonCallback<SocialContactAllTopicsBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getRecommendTopicsList().subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SocialContactAllTopicsBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SocialContactAllTopicsBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //首页圈子的推荐圈子
    public void getHomeRecommendGroup(String pageNum, String pageSize, ApiModel.CommonCallback<CommunityCentreBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getHomeRecommendGroup(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<CommunityCentreBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(CommunityCentreBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //圈子首页
    public void getRecommendGroupDetail(String id, ApiModel.CommonCallback<MainSocialHeadBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getRecommendGroupDetail(id).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainSocialHeadBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainSocialHeadBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区推荐
    public void getRecommendList(int pageNum, int pageSize, ApiModel.CommonCallback<MainSocialContactRecommendBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getCommunityRecommendList(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainSocialContactRecommendBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainSocialContactRecommendBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区附近,附近的人列表
    public void getNearManAndDynamic(String mapLng, String mapLat, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getNearManAndDynamic(mapLng, mapLat).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<String>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(String baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区附近动态
    public void getNearManAndDynamicTopic(String mapLng, String mapLat, int pageNum, int pageSize, ApiModel.CommonCallback<NearManAndDynamicTopicBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getNearManAndDynamicTopic(mapLng, mapLat, pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<NearManAndDynamicTopicBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(NearManAndDynamicTopicBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区视频动态
    public void getVideoTopic(int pageNum, int pageSize, String userId, ApiModel.CommonCallback<VideoTopicBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getVideoTopic(pageNum, pageSize, userId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<VideoTopicBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(VideoTopicBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区关注-可能认识的人
    public static void getMaybeKnow(int pageNum, int pageSize, ApiModel.CommonCallback<AttentionManAndDynamicBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getMaybeKnow(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<AttentionManAndDynamicBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(AttentionManAndDynamicBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }


        });
    }

    //社区关注-动态列表
    public void getSubscribersList(int pageNum, int pageSize, ApiModel.CommonCallback<SubscribersListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getSubscribersList(pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SubscribersListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SubscribersListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //圈子详情-圈子动态
    public static void getTopicList(String groupId, int pageNum, int pageSize, ApiModel.CommonCallback<CircleTopicListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).geToPicList(groupId, pageNum, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<CircleTopicListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(CircleTopicListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //圈子详情-圈子动态最热
    public void getTopicHottestList(String groupId, int pageNum, int pageSize, String orderByClause, ApiModel.CommonCallback<CircleTopicListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).gePicList(groupId, pageNum, pageSize, orderByClause).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<CircleTopicListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(CircleTopicListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //更多圈子
    public void getByPageList(int pageNum, int pageSize, String groupname, ApiModel.CommonCallback<ByPageListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getByPageLis(pageNum, pageSize, groupname).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<ByPageListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(ByPageListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //圈子-（我的）退出圈子
    public void setIntroductionGroupMembers(String id, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).setIntroductionGroupMembers(id).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<String>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(String baseEntity) throws Exception {
                callback.onSuccess(baseEntity);

            }

        });
    }

    //圈子-（我的）申请入圈
    public void setApplyGroup(String groupId, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).setApplyGroup(groupId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<String>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(String baseEntity) throws Exception {
                callback.onSuccess(baseEntity);

            }

        });
    }

    //更多圈子
    public void getQueryGroupMembers(int pageSize, String groupId, int pageNum, ApiModel.CommonCallback<SocialAllListMember> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getQueryGroupMembers(pageSize, groupId, pageNum).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SocialAllListMember>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SocialAllListMember baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //查看他人的个人中心
    public static void getGaUserExtVoById(String userId, ApiModel.CommonCallback<SocialPersonalHomepageBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getGaUserExtVoById(userId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SocialPersonalHomepageBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SocialPersonalHomepageBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //查看自己的个人中心
    public void getMyGaUserExtVoById(ApiModel.CommonCallback<SocialPersonalMyHomepageBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getMyGaUserExtVoById().subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SocialPersonalMyHomepageBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SocialPersonalMyHomepageBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //个人中心的送礼列表
    public static void getSelectByGsPresentPageList(ApiModel.CommonCallback<GivePresentBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getSelectByGsPresentPageList().subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<GivePresentBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(GivePresentBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //个人中心动态列表
    public void getSelectTopicInfoListByUserId(int pageNum, String userId, int pageSize, ApiModel.CommonCallback<HomeTopicListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getSelectTopicInfoListByUserId(pageNum, userId, pageSize).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<HomeTopicListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(HomeTopicListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    /**
     * 送礼
     *
     * @param targetUserId 收益人id
     * @param targetId     礼物id
     * @param callback
     */
    public static void addOrUpdateGive(String targetUserId, String targetId, ApiModel.CommonCallback<GiftResultBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).addOrUpdateGive(targetUserId, targetId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<GiftResultBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(GiftResultBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //动态详情评论列表
    public static void getPageInfo(String pageNum, String pageSize, String topicId, ApiModel.CommonCallback<MainPersonalStateBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getPageInfo(pageNum, pageSize, topicId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<MainPersonalStateBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(MainPersonalStateBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //动态详情
    public static void getTopicById(String id, ApiModel.CommonCallback<GroupTopicListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getTopicById(id).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<GroupTopicListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(GroupTopicListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //发布评论
    public static void setComment(RequestBody body, ApiModel.CommonCallback<PublishListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class)
                .addComment(body)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<PublishListBean>() {
                    @Override
                    public void onFailure(Throwable e, boolean isNetWorkError) {
                        callback.onError(e.getMessage());
                    }

                    @Override
                    protected void onCodeError(PublishListBean baseEntity) throws Exception {
                        callback.onError(baseEntity.getMessage());
                    }

                    @Override
                    public void onSuccess(PublishListBean respBase) {
                        callback.onSuccess(respBase);
                    }
                });
    }

    //点赞，评论，浏览
    public static void saveGsTopicFavour(String topicId, String type, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class)
                .saveGsTopicFavour(topicId, type)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<String>() {
                    @Override
                    public void onFailure(Throwable e, boolean isNetWorkError) {
                        callback.onError(e.getMessage());
                    }

                    @Override
                    public void onSuccess(String respBase) {
                        callback.onSuccess(respBase);
                    }
                });
    }

    //取消点赞，评论，浏览
    public static void delGsTopicFavour(String type, String topicId, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class)
                .setDelGsTopicFavour(type, topicId)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<String>() {
                    @Override
                    public void onFailure(Throwable e, boolean isNetWorkError) {
                        callback.onError(e.getMessage());
                    }

                    @Override
                    public void onSuccess(String respBase) {
                        callback.onSuccess(respBase);
                    }
                });
    }

    //取消收藏
    public static void delGsCollectDelete(String activityId, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class)
                .setCollectDelete(activityId)
                .subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<String>() {
                    @Override
                    public void onFailure(Throwable e, boolean isNetWorkError) {
                        callback.onError(e.getMessage());
                    }

                    @Override
                    public void onSuccess(String respBase) {
                        callback.onSuccess(respBase);
                    }
                });
    }

    //获取点赞列表
    public static void getGiveList(String topicId, String pageSize, String pageNum, ApiModel.CommonCallback<SocialStateGiveListLikeBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getGiveList(topicId, pageSize, pageNum).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SocialStateGiveListLikeBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SocialStateGiveListLikeBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }

        });
    }

    //获取浏览列表
    public static void getBrowseList(String id, String pageSize, String pageNum, ApiModel.CommonCallback<BrowseListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getBrowseList(id, pageSize, pageNum).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<BrowseListBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(BrowseListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }

        });
    }

    //检查个人信息是否完整
    public static void getQueryIsPerfect(ApiModel.CommonCallback<PerfectBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getQueryIsPerfect().subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<PerfectBean>() {


            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(PerfectBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //获得附近人员列表
    public static void getSelectMyNearby(int pageNum, int pageSize, String lng, String lat, String sex, ApiModel.CommonCallback<SelectNearbyListBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getSelectMyNearby(pageNum, pageSize, lng, lat, sex).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<SelectNearbyListBean>() {


            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(SelectNearbyListBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }
        });
    }

    //获取话题详情
    public static void getBrowseLisGroupDetail(String topicId, String topicDesc, ApiModel.CommonCallback<GroupDetailBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).getGroupDetail(topicId, topicDesc).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<GroupDetailBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(GroupDetailBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }

        });
    }

    //浏览名片,动态
    public static void setSaveViewParameter(String viewType, String id, String source, ApiModel.CommonCallback<String> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).saveViewParameter(viewType, id, source).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<String>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(String baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }

        });
    }

    //浏览名片,动态
    public static void setaddOrUpdateReward(String targetId, ApiModel.CommonCallback<GiftResultBean> callback) {
        RetrofitFactory.getJavaRetrofit().create(MainSocialContactApi.class).addOrUndateReward(targetId).subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread()).subscribe(new BaseObserver<GiftResultBean>() {
            @Override
            protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {
                callback.onError(e.getMessage());
            }

            @Override
            protected void onSuccess(GiftResultBean baseEntity) throws Exception {
                callback.onSuccess(baseEntity);
            }

        });
    }
}
